package work.com.Exam01;

import java.util.Objects;

public class Person {
    private String name;
    private  Character gander;
    private  Integer age;
    private  Boolean marry;
    public Person(Person person){
        this(person.name, person.gander, person.age, person.marry);
    }

    public Person(String name, Character gander, Integer age, Boolean marry) {
        this.name = name;
        this.gander = gander;
        this.age = age;
        this.marry = marry;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setGander(Character gander) {
        this.gander = gander;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public void setMarry(Boolean marry) {
        this.marry = marry;
    }

    public String getName() {
        return name;
    }

    public Character getGander() {
        return gander;
    }

    public Integer getAge() {
        return age;
    }

    public Boolean getMarry() {
        return marry;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", gander=" + gander +
                ", age=" + age +
                ", marry=" + marry +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return Objects.equals(name, person.name) && Objects.equals(gander, person.gander) && Objects.equals(age, person.age) && Objects.equals(marry, person.marry);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, gander, age, marry);
    }
}
